// stores/counter.js
import {
	defineStore
} from 'pinia';

export const useCounterStore = defineStore('counter', {
	state: () => {
		return {
			user: uni.getStorageSync('user'),
			enterInfo: {
				keyword: '',
				address: '',
				lng: '',
				lat: '',
				start: '',
				end: '',
				day: '0',
				star_id: '',
				price: '',
				type: '',
				house: [{
					type_id: '',
					adult: 0,
					children: 0
				}],
				score_id: '',
				free_id: '',
				support_id: '',
				charge_id: ''
			}
		};
	},
	unistorage: true,
	// 也可以这样定义
	// state: () => ({ count: 0 })
	actions: {
		// 报错
		setregister(data) {
			this.user = data
		},
		clones() {
			console.log("");
			this.enterInfo = {
				order_id: '',
				keyword: '',
				address: '',
				addressname: '',
				lng: '',
				lat: '',
				start: '',
				end: '',
				day: '1',
				star_id: '0',
				price: 100,
				type: '',
				house: [{
					type_id: '0',
					adult: 1,
					children: 0
				}],
				score_id: '0',
				free_id: [],
				support_id: [],
				charge_id: [],
				distance: 5
			}
		},
		setOrder(data) {
			this.orderinfo = data
		},
		setuser(data) {
			console.log("====12=======");
			this.user = data
			uni.setStorageSync('user', data)
		},
	},


});